import service from "@/utils/request.js";

const getActive = (params) => {
  return service({
    method: "get",
    url: "/app-api/promotion/reservation-activity/page",
    params,
  });
};

const login = (data) => {
  return service({
    method: "post",
    url: "/app-api/member/auth/login",
    data,
  });
};

const userData = () => {
  return service({
    method: "get",
    url: "/app-api/member/user/get",
    // data,
  });
};

const postOss = (data) => {
  return service({
    method: "post",
    url: "/admin-api/infra/file/upload",
    data,
    headers: {
      "Content-Type": "multipart/form-data",
    },
  });
};

const changeUser = (data) => {
  return service({
    method: "put",
    url: "/app-api/member/user/update",
    data,
  });
};

const userOrderList = (params) => {
  return service({
    method: "get",
    url: "/app-api/trade/order/page",
    params,
  });
};

const userOrderDetial = (params) => {
  return service({
    method: "get",
    url: "/app-api/trade/order/get-detail",
    params,
  });
};

const postUser = (data) => {
  return service({
    method: "post",
    url: "/app-api/member/user/register",
    data,
  });
};

const getPoints = (params) => {
  return service({
    method: "get",
    url: "/app-api/member/point/record/page",
    params,
  });
};

const getAcitveOrder = (params) => {
  return service({
    method: "get",
    url: "/app-api/promotion/reservation-record/page",
    params,
  });
};

const acitveOrderDetail = (params) => {
  return service({
    method: "get",
    url: "/app-api/promotion/reservation-record/get",
    params,
  });
};

const postActiveOrder = (data) => {
  return service({
    method: "post",
    url: "/app-api/promotion/reservation-record/create",
    data,
  });
};

const updateActiveOrder = (data) => {
  return service({
    method: "put",
    url: "/app-api/promotion/reservation-record/update",
    data,
  });
};

const QRcode = (params) => {
  return service({
    method: "get",
    url: "/app-api/trade/qrcode/generate",
    params,
  });
};

const getInvoice = (params) => {
  return service({
    method: "get",
    url: "/app-api/member/order-invoice/order-page",
    params,
  });
};

const postInvoice = (data) => {
  return service({
    method: "post",
    url: "/app-api/member/order-invoice/create",
    data,
  });
};
const getInvoiceDetail = (params) => {
  return service({
    method: "get",
    url: "/admin-api/member/order-invoice/get",
    params,
  });
};
const getOrderInvoiceDetail = (params) => {
  return service({
    method: "get",
    url: "/app-api/member/order-invoice/page",
    params,
  });
};

const getTitle = (params) => {
  return service({
    method: "get",
    url: "/app-api/member/invoice/page",
    params,
  });
};
const getTitleData = (params) => {
  return service({
    method: "get",
    url: "/app-api/member/invoice/get",
    params,
  });
};

const postTitle = (data) => {
  return service({
    method: "post",
    url: "/app-api/member/invoice/create",
    data,
  });
};

const putTitle = (data) => {
  return service({
    method: "put",
    url: "/app-api/member/invoice/update",
    data,
  });
};

const deleteTitle = (params) => {
  return service({
    method: "delete",
    url: "/app-api/member/invoice/delete",
    params,
  });
};

const getFriend = (params) => {
  return service({
    method: "get",
    url: "/app-api/trade/gift-claim-record/page",
    params,
  });
};
export {
  getActive,
  login,
  userData,
  postOss,
  changeUser,
  userOrderList,
  userOrderDetial,
  postUser,
  getPoints,
  getAcitveOrder,
  acitveOrderDetail,
  postActiveOrder,
  updateActiveOrder,
  QRcode,
  getInvoice,
  getInvoiceDetail,
  getTitle,
  postTitle,
  getTitleData,
  putTitle,
  deleteTitle,
  postInvoice,
  getOrderInvoiceDetail,
  getFriend,
};
